/**
 * Created by win 10 on 1/10/2018.
 */
import axios from 'axios'
import utils from '../../static/utils'
const actions = {
  // increment: ({commit}) => commit({type: 'increment', amount: 10}),
  // incrementIfOdd ({ commit, state }) {
  //   if ((state.count + 1) % 2 === 0) {
  //     commit('increment')
  //   }
  // }
  // 这里的this指向Story 而非指向vue实例
  recodeHistory ({commit}, str) {
    axios.get('http://www.finewest.cn:8888/fwapi/fcodeHistory?userName=' + str).then(function (response) {
      for (let i = 0; i < response.data.data.length; i++) {
        response.data.data[i].addTime = utils.parseCastingDate(response.data.data[i].addTime, 'yyyy.MM.dd')
      }
      commit('recodeHistory', response)
    }).catch(function (response) {
      commit({type: 'recodeHistory', response: response})
    })
  }
}

export default actions
